package com.boyuan.aboutcase;

import com.boyuan.huijiaoyu.R;
import com.boyuan.huijiaoyu.R.layout;
import com.magicsoft.constant.Constant;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;

public class CaseChangeStatusActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_case_change_status);
		initUI();
	}
	
	private void initUI() {
		findViewById(R.id.tv_untreated).setOnClickListener(this);
		findViewById(R.id.tv_processing).setOnClickListener(this);
		findViewById(R.id.tv_closed).setOnClickListener(this);
		findViewById(R.id.tv_Waiting_confirm).setOnClickListener(this);
		findViewById(R.id.tv_completed).setOnClickListener(this);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		finish();
		return super.onTouchEvent(event);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_untreated:
			setUntreated();
			break;
		case R.id.tv_processing:
			setProcessing();
			break;
		case R.id.tv_closed:
			setClosed();
			break;
		case R.id.tv_Waiting_confirm:
			setWaiting_confirm();
			break;
		case R.id.tv_completed:
			setCompleted();
			break;

		default:
			break;
		}
	}

	private void setCompleted() {
		Intent data  = new Intent();
		data.putExtra(Constant.CaseChangeStatus, "已完成");
		setResult(Constant.CaseChangeStatus_CODE, data);
		finish();
	}

	private void setWaiting_confirm() {
		Intent data  = new Intent();
		data.putExtra(Constant.CaseChangeStatus, "等待客户确认");
		setResult(Constant.CaseChangeStatus_CODE, data);
		finish();
	}

	private void setClosed() {
		Intent data  = new Intent();
		data.putExtra(Constant.CaseChangeStatus, "已关闭");
		setResult(Constant.CaseChangeStatus_CODE, data);
		finish();
	}

	private void setProcessing() {
		Intent data  = new Intent();
		data.putExtra(Constant.CaseChangeStatus, "处理中");
		setResult(Constant.CaseChangeStatus_CODE, data);
		finish();
	}

	private void setUntreated() {
		Intent data  = new Intent();
		data.putExtra(Constant.CaseChangeStatus, "未处理");
		setResult(Constant.CaseChangeStatus_CODE, data);
		finish();
	}
	
}
